import numpy as np


def read_npy_file(file_path):
    """
    读取npy文件并返回其内容和维度信息

    参数:
        file_path: npy文件路径

    返回:
        data: numpy数组数据
        shape: 数组维度
    """
    try:
        data = np.load(file_path)
        print("文件内容:")
        print(data)
        print("\n数组维度:", data.shape)
        return data, data.shape
    except Exception as e:
        print(f"读取文件时出错: {e}")
        return None, None


# 使用示例
if __name__ == "__main__":
    # 替换为你的npy文件路径
    npy_file = r"/ACRmodel/static/dataset/拟南芥/1/label_train.npy"
    data, shape = read_npy_file(npy_file)
